import { resolve } from 'path'

// External dependencies that should not be bundled
export const externalDeps = [
  'vue',
  'element-plus',
  '@element-plus/icons-vue',
  'axios',
  'dayjs',
  'lodash-es',
  'echarts',
  'vue-router',
  '@vueuse/core',
  'echarts-wordcloud',
  'nprogress',
]

// Global variable mappings for UMD build
export const globalVarMap = {
  vue: 'Vue',
  'element-plus': 'ElementPlus',
  '@element-plus/icons-vue': 'ElementPlusIconsVue',
  'axios': 'axios',
  'dayjs': 'dayjs',
  'lodash-es': '_',
  'echarts': 'echarts',
  'vue-router': 'VueRouter',
  '@vueuse/core': 'VueUse',
  'echarts-wordcloud': 'echartsWordcloud',
  'nprogress': 'NProgress',
}

// CSS optimization configuration
export const cssOptimization = {
  preprocessorOptions: {
    scss: {
      additionalData: `@import "@/styles/variables.scss";`
    }
  }
}

// Development optimizations
export const devOptimizeDeps = {
  include: ['element-plus/es/locale/lang/zh-cn', 'element-plus/es/locale/lang/en']
}

// Performance-related configurations
export const performanceConfig = {
  sourcemap: true,
  minify: 'terser',
  terserOptions: {
    compress: {
      drop_console: false,
      drop_debugger: true
    }
  }
}

// Multi-format output configuration for rollup
export const multiFormatOutput = {
  exports: 'named',
  globals: globalVarMap,
  preserveModules: true,
  preserveModulesRoot: 'src'
} 